package com.heima.wemedia.utils;

import com.heima.utils.common.AppJwtUtil;
import io.jsonwebtoken.Claims;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 嘉德罗斯
 * @date 2021/11/22
 */
public class Token {

    public static Integer getId(HttpServletRequest request){
        String token = request.getHeader("token");
        Claims body = AppJwtUtil.getClaimsBody(token);
        Object i =  body.get("id");
        int id = Integer.parseInt(i.toString());
        return id;
    }
}
